<div class='stage <%= stage.pay_status %>_stage'>
  <div class='head'>
    <div class='name half_corner <%= stage.pay_status %>'>
      <%= link_to_function "▶#{stage.name}",
                "show_or_hide_stage('#{stage.id}',this)",
                :class => 'low base'
         %>
    </div>
    <div class='should_be_pay'><%= t stage.pay_status %>:<b>￥</b><small><%= designer.should_be_payed_by_stage_id(stage.id) %></small></div>
    <div class='date'>结算期：<b><%= stage.started_on %></b>~<b><%= stage.ended_on %></b></div>
    <% if stage.payed? %>
    <div class="payed_on date ">发放日期：<b><%= stage.payed_on %></b></div>
    <% end %>
  </div>
  <div id="stage_<%= stage.id %>_work_item_types"
       class='pay_info <%= stage.pay_status %>_stage_pay_info'
       style="display:none">
    <% designer.work_item_types_by_stage_id(stage.id).each do |work_item_type| %>
    <div class='type' title="<%= stage.project.name %>-<%= stage.name %>-<%= work_item_type.name %>">
      <div class='head' >
        <div class='title' >
          <div>【<%= work_item_type.name %>】</div>
        </div>
      </div>
      <div class='designers'>
        <div class='designer'>
          <div class='items'>
            <table cellspacing='1' cellpadding='1' >
              <tr>
                <th>工作项</th>
                <th>单价</th>
                <th>计费面积</th>
                <th>工作量</th>
                <th>发放</th>
                <th>指导</th>
                <th>类型</th>
                <th>难度</th>
                <th>修改</th>
                <th>应得金额</th>
              </tr>
              <% designer.designer_work_items_by_stage_id_and_work_item_type_id(stage.id,work_item_type.id).each do |designer_work_item| %>
                <tr >
                  <td><%= designer_work_item.try(:work_item).try(:name) %></td>
                  <td align='right'><%= designer_work_item.try(:work_item).try(:pay_unit) %></td>
                  <td align='right'><%= designer_work_item.billing_area %></td>
                  <td align='right'><%= designer_work_item.work_load %> %</td>
                  <td align='right'><%= designer_work_item.provided_percent %> %</td>
                  <td align='right'><%= designer_work_item.guided_percent %> %</td>
                  <td align='right'><%= designer_work_item.type_num %> %</td>
                  <td align='right'><%= designer_work_item.motify_num %> %</td>
                  <td align='right'><%= designer_work_item.difficulty_num %> %</td>
                  <td align='right' class='money'>￥<%= number_with_precision designer_work_item.should_be_payed, :precision => 1 %></td>
                </tr>
              <% end %>
              <tr>
                <td align='right' colspan='10' class='total'>
                  合计：<b>￥<%= number_with_precision designer.should_be_payed_by_stage_id_and_work_item_type_id(stage.id, work_item_type.id), :precision => 1 %></b>
                </td>
              </tr>
            </table>
          </div>
        </div>
      </div>
    </div>
    <% end %>
  </div>
</div>
